package com.middle.experiment01.Service.impl;


import com.middle.experiment01.Service.CourseService;
import com.middle.experiment01.entity.Course;
import com.middle.experiment01.entity.Student;
import com.middle.experiment01.mapper.CourseMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseMapper courseMapper;

    public Course getById(String id) {
        Course course=courseMapper.getById(id);
        return course;
    }


    public List<Course> pageAllCourse() {
        return courseMapper.pageAllCourse();
    }

    public void save(Course course) {
        courseMapper.insert(course);
    }

    public void deleteById(String id) {
        courseMapper.deleteById(id);
    }

    public void update(Course course) {
        courseMapper.update(course);
    }

    public List<Student> getStudentById(String id) {
        List<Student> list=courseMapper.getStudentById(id);
        return list;
    }


}
